<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<%
 String path = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getServletContext().getContextPath()+"/";
%>
<head>
<base href="<%=path%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加视频</title>
<style>
        .jumbotron {
            width: 80%;
            margin: auto;
            margin-top: -60px;
            border-radius: 5px;
        }

        .jumbotron h3 {
            margin-left: 50px;
            margin-top: 20px;
        }

        #div1 {
            width: 90%;
            margin: auto;
        }

        #div2 {
            width: 80%;
            height: 600px;
            text-align: right;
            margin: auto;
            margin-top: 30px;
        }

        #b1 {
            margin-top: 20px;
            margin-right: 1130px;

        }
    </style>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
        crossorigin="anonymous">
</head>
<script type="text/javascript">
  function validate_required(field,alerttext){
	  with (field){
		  if (value == null||value == "") {
			alert(alerttext);
			return false
		}else{
			return true
		}
	  }
  }

  function validate_form(thisform){
	  with(thisform){
		  if (validate_required(video_title,"带有*的必须填写哦!")==false) {
			email.focus();
			return false
		}
	  }
  }
/*onsubmit="return validate_form(this)" */
</script>
<body>
 	 <nav class="navbar navbar-inverse">
	<div class="container-fluid">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed"
				data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
				aria-expanded="false">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#">视频管理系统</a>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse"
			id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li><a href="video/video_list.do">视频管理 <span class="sr-only">(current)</span>
				</a></li>
				<li><a href="speaker/speaker_list.do">主讲人管理</a></li>
				<li><a href="course/course_list.do">课程管理</a></li>
				<li><a href="tjfx/tjfx2.do">课程分析</a></li>
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li><a href="admin/loginOut.do">admin 
				<span class="glyphicon glyphicon-log-out" aria-hidden="true"></span>
				</a></li>
			</ul>
		</div>
		<!-- /.navbar-collapse -->
	</div>
	<!-- /.container-fluid --> </nav>

    <div class="jumbotron">
        <h3>添加视频信息 - 视频管理</h3>
    </div>

    <div id="div2">
        <form class="form-horizontal" action="video/add_video.do" method="post"> 

                <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">视频标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="video_title" id="inputEmail3" value="" placeholder="请输入视频标题" required>
                        </div>
                </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">主讲人</label>
                <div class="col-sm-10">
                    <select name="speaker_id" class="form-control" id="inputEmail3" required="required">
                      <option value="">请选择主讲人</option>
                      <c:forEach items="${speakers}" var="speaker">
                      <option value="${speaker.id}">${speaker.speaker_name}</option>
                      </c:forEach>
                    </select>
                    <br>
                </div>
            </div>
             <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">所属课程</label>
                    <div class="col-sm-10">
                        <select name="course_id" class="form-control" id="inputEmail3" required="required">
                            <option value="">请选择课程</option>
                            <c:forEach items="${courses }" var="course">
                            <option value="${course.id}">${course.course_name}</option>
                            </c:forEach>
                        </select>
                        <br>
                    </div>
                </div> 
                <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">视频时长</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="inputEmail3" name="video_length" placeholder="请输入时长" required>
                        </div>
                    </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">封面图片</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="inputEmail3" name="video_image_url" placeholder="请加载图片" required>
                </div>
            </div>
            <div class="form-group">
                    <label for="inputEmail3" class="col-sm-2 control-label">视频播放地址</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="inputEmail3" name="video_url" placeholder="请输入视频播放地址" required>
                    </div>
                </div>
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">视频简介</label>
                <div class="col-sm-10">
                    <textarea class="form-control" rows="3"  name ="video_descr" placeholder="请输入视频简介"  required></textarea>
                </div>
            </div>
            <div id="b1">
                    <button type="submit" class="btn btn-primary btn-lg active">保存</button>
                    <a href="video/video_list.do"><button type="button" class="btn btn-default btn-lg active">返回列表</button></a>
            </div>
        </form>
    </div>
</body>
</html>